<?php
//Función para conectar y seleccionar DB
function connectBD($ip, $userdb, $passworddb, $db)
{
	$conexion = mysql_connect($ip, $userdb, $passworddb);
	
	if($conexion)
	{
		$db_selected = mysql_select_db($db, $conexion);
		if($db_selected)
		{
			return true;
		}
	}
	else
	{
		return false;
	}
}

//Función login usuarios
function login($user, $password)
{
	$query = "SELECT Name, Password FROM Users WHERE Name='$user'";
	$result = mysql_query($query);
	$row = @mysql_fetch_row(($result));
	
	if(($row[0] == $user) && ($row[1] == $password))
	{
		return true;
	}
	else
	{
		return false;
	}
}

?>